physics_particle_group_add_point

Set the points of the polygon shape which will be used to create a group of soft body particles.

语法:

physics_particle_group_add_point(x, y)


参数 描述
x The x position in the room for the point.
y The y position in the room for the point.


返回: N/A(无返回值)


描述

This function sets a point in the room to define the shape of a polygon which will be used to create a group of soft body particles. You must have previously signalled to GameMaker Studio 2 that you are going define a polygon shape using the function physics_particle_group_polygon() and then use this function to define the individual points of the polygon. You must give at least three points when defining the polygon shape, but can give up to eight, and the function will permit the definition of concave polygons. However, if you generate a polygon with any cavities, the points within will be ignored and a convex shape will be created for the particle group.


例如:

var flags = phy_particle_flag_water | phy_particle_flag_viscous | phy_particle_flag_tensile;
var groupflags = phy_particle_group_flag_solid;
physics_particle_group_begin(flags, groupflags, mouse_x, mouse_y, 0, 0, 0, 0, c_white, 1, 1, 2);
physics_particle_group_polygon();
physics_particle_group_add_point(200, 200);
physics_particle_group_add_point(300, 300);
physics_particle_group_add_point(100, 300);
mLastGroup = physics_particle_group_end();

The above code stores the flags for the particle type and the particle group properties in variables then uses these to create a polygon particle group of three sides at the mouse position.


上一页: Soft Body Particles
下一页: physics_particle_group_end
© Copyright YoYo Games Ltd. 2018 All Rights Reserved